package chapter9;

public class Triangle {
    int a;
    int b;
    int c;

    //全参构造，对属性进行赋值
    public Triangle(int a,int b,int c){
        this.a=a;
        this.b=b;
        this.c=c;
    }

    //检验任何两条边是否大于第三条边
    public boolean ValidateTriangle(){
        boolean va=true;
        if(a+b<c){
            va=false;
        }else if(a+c<b) {
           va =false;
        }else if (b+c<a){
            va=false;
        }
        return va;
    }

    //调用检验，显示结果
    public  void show(){
        if(ValidateTriangle()){
            System.out.println("构成三角形，三条边为"+a+" ,"+b+" ,"+c);
        }else {
            System.out.println("三条边为"+a+" ,"+b+" ,"+c+"长度不能构成三角形");
        }
    }
}
